package com.rc.saas.tenant.vo.acct;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.rc.saas.tenant.model.acct.AcctWithdrawApply;
import com.rc.saas.tenant.model.acct.AcctWithdrawInvoice;
import org.springframework.util.CollectionUtils;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.List;

/**
 * @author frog
 * @date 2021/1/25
 */
@ExcelIgnoreUnannotated
public class AcctWithdrawApplyResult extends AcctWithdrawApply {
    @ExcelProperty(value = "分销商名称", index = 0)
    private String operatorName;
    @ExcelProperty(value = "分销商账号", index = 1)
    private String loginName;
    @ExcelProperty(value = "提现订单号", index = 2)
    private String outTradeNo;
    @ExcelProperty(value = "失败原因", index = 10)
    private String errCodeDes;
    @ExcelProperty(value = "提现手续费",index = 11)
    private BigDecimal withdrawServiceCharge;
    @ExcelProperty(value = "结算转账方式",index = 12)
    private String transferMethod;
    //提现审核方式（0：人工审核；1：自动审核）
    private String withdrawAudit;

    private List<AcctBillOrderResultVo> acctBillOrderList;

    private List<AcctWithdrawInvoice> acctWithdrawInvoiceList;
    @ExcelProperty(value = "对应账单", index = 6)
    private String orderBill;

    public String getOrderBill() {
        if (CollectionUtils.isEmpty(acctBillOrderList)) {
            return "";
        } else {
            StringBuilder sb = new StringBuilder();
            int i = 1;
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            for (AcctBillOrderResultVo acctBillOrderResultVo : acctBillOrderList) {
                if (acctBillOrderResultVo.getBillStartTime() != null && acctBillOrderResultVo.getBillEndTime() != null) {
                    sb.append(i + "、" + acctBillOrderResultVo.getFactAmount() + "元" + format.format(acctBillOrderResultVo.getBillStartTime()) + "至" + format.format(acctBillOrderResultVo.getBillEndTime()) + acctBillOrderResultVo.getStationName() + ";");
                } else {
                    sb.append(i + "、" + acctBillOrderResultVo.getFactAmount() + "元" + "时间为空" + acctBillOrderResultVo.getStationName() + ";");
                }
                i++;
            }
            return sb.toString();
        }
    }

    public void setOrderBill(String orderBill) {
        this.orderBill = orderBill;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public String getErrCodeDes() {
        return errCodeDes;
    }

    public void setErrCodeDes(String errCodeDes) {
        this.errCodeDes = errCodeDes;
    }

    public List<AcctWithdrawInvoice> getAcctWithdrawInvoiceList() {
        return acctWithdrawInvoiceList;
    }

    public void setAcctWithdrawInvoiceList(List<AcctWithdrawInvoice> acctWithdrawInvoiceList) {
        this.acctWithdrawInvoiceList = acctWithdrawInvoiceList;
    }

    public List<AcctBillOrderResultVo> getAcctBillOrderList() {
        return acctBillOrderList;
    }

    public void setAcctBillOrderList(List<AcctBillOrderResultVo> acctBillOrderList) {
        this.acctBillOrderList = acctBillOrderList;
    }

    public String getOperatorName() {
        return operatorName;
    }

    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public BigDecimal getWithdrawServiceCharge() {
        return withdrawServiceCharge;
    }

    public void setWithdrawServiceCharge(BigDecimal withdrawServiceCharge) {
        this.withdrawServiceCharge = withdrawServiceCharge;
    }

    public String getTransferMethod() {
        return transferMethod;
    }

    public void setTransferMethod(String transferMethod) {
        this.transferMethod = transferMethod;
    }

    public String getWithdrawAudit() {
        return withdrawAudit;
    }

    public void setWithdrawAudit(String withdrawAudit) {
        this.withdrawAudit = withdrawAudit;
    }
}
